import request, { uploadImg } from '@/utils/request'

// 待办列表
export function workTodoList() {
  return request({
    url: '/work/todo/list',
    method: 'GET',
  })
}
// 进行中列表
export function workGoingList() {
  return request({
    url: '/work/going/list',
    method: 'GET',
  })
}
// 获取企业信息
export function getCompanyMsg() {
  return request({
    url: '/enterprise/get',
    method: 'GET',
  })
}
// 获取产品列表
export function getProductionList() {
  return request({
    url: '/project/config/list',
    method: 'GET'
  })
}
// 开通产品
export function openProduction(data) {
  return request({
    url: '/enterprise/project/add',
    method: 'POST',
    data
  })
}
// 项目列表
export function getProjectList(params) {
  return request({
    url: '/project/assets/list',
    method: 'GET',
    params,
  })
}
// 新增项目
export function addProject(data) {
  return request({
    url: '/project/assets/add',
    method: 'POST',
    data,
  })
}
// 编辑项目
export function editProject(data) {
  return request({
    url: '/project/assets/edit',
    method: 'PUT',
    data,
  })
}
// 查看项目详情
export function projectDetail(id) {
  return request({
    url: `/project/assets/get/${id}`,
    method: 'GET'
  })
}
// 项目审核
export function projectCheck(id, params) {
  return request({
    url: `/project/assets/examine/${id}`,
    method: 'POST',
    params,
  })
}
// 上传文件
export function uploadFile(data) {
  return uploadImg('/common/upload', data, { timeout: 60000 })
}
// 发票ocr识别
export function ocrInvoice(data) {
  return uploadImg('/ocrInvoice', data, { timeout: 60000 })
}
// 申请授信
export function addCredit(data) {
  return request({
    url: '/credit/add',
    method: 'POST',
    data,
  })
}
// 授信保存
export function saveCredit(data) {
  return request({
    url: '/credit/cache/add',
    method: 'POST',
    data
  })
}
// 获取授信保存
export function getSaveCredit() {
  return request({
    url: '/credit/getCreditCache',
    method: 'GET',
  })
}
// 授信列表
export function creditList(params) {
  return request({
    url: '/credit/list',
    method: 'GET',
    params,
  })
}
// 获取授信详情数据
export function creditDetail(id, userType) {
  return request({
    url: `/credit/getCreditById/${id}?userType=${userType}`,
    method: 'GET',
  })
}
// 授信审核
export function creditCheck(id, params) {
  return request({
    url: `/credit/examine/${id}`,
    method: 'POST',
    params
  })
}
// 机构列表
export function jigouList(params) {
  return request({
    url: '/financing/config/list',
    method: 'GET',
    params
  })
}
// 融资列表
export function financingList(params) {
  return request({
    url: '/financing/list',
    method: 'GET',
    params,
  })
}
// 申请融资
export function addFinancing(data) {
  return request({
    url: '/financing/add',
    method: 'POST',
    data,
  })
}
// 保存融资
export function saveFinancing(data) {
  return request({
    url: '/financing/cache/add',
    method: 'POST',
    data
  })
}
// 获取保存融资
export function getSaveFinancing() {
  return request({
    url: '/financing/getCreditCache',
    method: 'GET'
  })
}
// 融资详情
export function financingDetail(id, userType) {
  return request({
    url: `/financing/get/${id}?userType=${userType}`,
    method: 'GET',
  })
}
// 融资审核
export function financingCheck(id, params) {
  return request({
    url: `/financing/examine/${id}`,
    method: 'POST',
    params,
  })
}
